package capr.camera;

import java.util.HashMap;
import com.jme.input.ChaseCamera;
import com.jme.input.thirdperson.ThirdPersonMouseLook;
import com.jme.math.FastMath;
import com.jme.renderer.Camera;
import com.jme.scene.Node;

/**
 * 
 * @author Gina Wagner
 * @author Tobias Bindler
 * 
 * Creates a ChaseCamera which can be added to a player-Node.
 * Based on Tutorial Lesson5 by Mark Powell.
 *
 */
public class CameraControl {
   

    public ChaseCamera chaser;

    /**
     * Gina Wagner, Tobias Bindler <br>
     * 
     * Builds the ChaseCamera-object that follows as a third-person-camera.
     * 
     * @param character: Node that contains the Player.
     * @param cam: Standard-Camera-Object.
     */
    public void buildChaseCamera(Node character, Camera cam) {
    	
    	
    	HashMap<String, Object> props = new HashMap<String, Object>();
        props.put(ChaseCamera.PROP_DAMPINGK, "4");
        props.put(ChaseCamera.PROP_SPRINGK, "9");
        props.put(ChaseCamera.PROP_MINDISTANCE, "20");
        props.put(ChaseCamera.PROP_MAXDISTANCE, "80");
        props.put(ThirdPersonMouseLook.PROP_MAXASCENT, "" + FastMath.DEG_TO_RAD * 45);
    	props.put(ThirdPersonMouseLook.PROP_MINASCENT, "" + FastMath.DEG_TO_RAD * 5);
        
        chaser = new ChaseCamera(cam, character, props);
	}

    /**
     * Gina Wagner, Tobias Bindler <br>
     * 
     * returns the ChaseCamera-Objekt
     * 
     * @return chaser: ChaseCamera-object
     */
	public ChaseCamera getChaser() {
		
		return chaser;
	}
}